package com.bridgeQQ.client.control.commands
{
	import com.bridgeQQ.client.core.ICommand;
	import com.bridgeQQ.client.model.BridgeModel;
	
	import flash.desktop.NativeApplication;
	
	import mx.core.Application;
	
	public class LogOutCommand extends BaseWrapper implements ICommand
	{
		public function LogOutCommand(respond:BaseRespond)
		{
			super(respond);
		}
		
		public override function execute() : void
		{
			if(!BridgeModel.instance.user)
			{
				exit();
				return;
			}
			Application.application.service.consumer.unsubscribe();
			super.execute();
		}
		
		protected override function result(info:Object) : void
		{
			exit();
		}
		
		private function exit():void
        {
        	NativeApplication.nativeApplication.icon.bitmaps = [];
            NativeApplication.nativeApplication.exit();
        }
	}
}